//
//  YWSelectInspectionLineTypeTableViewController.m
//  maintain
//
//  Created by Kyo on 16/10/11.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import "YWSelectInspectionLineTypeTableViewController.h"
#import "UIColor+CustomColors.h"
#import "YWMacro.h"

#import "YWCreateEquipmentInspectLineTableViewController.h"
#import "YWCreateLocationInspectLineTableViewController.h"

@interface YWSelectInspectionLineTypeTableViewController ()

@end

@implementation YWSelectInspectionLineTypeTableViewController
- (instancetype)init{
    return [super initWithStyle:UITableViewStyleGrouped];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = NSLocalizedString(@"selectLineType", nil);//@"选择路线类型";
    self.view.backgroundColor = [UIColor customBackgroudColor];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *reuseIdentifier = @"selectLineTypeCellReuseIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        cell.textLabel.font = kContentFont;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    cell.textLabel.text = indexPath.row==0 ? NSLocalizedString(@"equipmentInspectionLine", nil) : NSLocalizedString(@"locationInspectionLine", nil);
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        YWCreateEquipmentInspectLineTableViewController *createEquipmentInspectVC = [[YWCreateEquipmentInspectLineTableViewController alloc] init];
        createEquipmentInspectVC.buildingId = self.buildingId;
        [self.navigationController pushViewController:createEquipmentInspectVC animated:YES];
    }else if (indexPath.row == 1){
        YWCreateLocationInspectLineTableViewController *createLocationInspectVC = [[YWCreateLocationInspectLineTableViewController alloc] init];
        createLocationInspectVC.buildingId = self.buildingId;
        [self.navigationController pushViewController:createLocationInspectVC animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
